package lhy.orm.model;

import lhy.orm.Serializer;
import org.apache.commons.text.StringEscapeUtils;

import java.io.Serializable;


public class EntityData implements Serializable {
    private String entityTableName;
    private String entityFullName;
    private String entityComment;
    private boolean isBasicBean;
    private boolean isTreeStructure;
    private boolean isViewOnly;
    private FieldData[] fields;

    public String getEntityTableName() {
        return entityTableName;
    }

    public void setEntityTableName(String entityTableName) {
        this.entityTableName = entityTableName;
    }

    public EntityData(String entityTableName, String entityFullName, String entityComment, boolean isBasicBean, boolean isTreeStructure, boolean isViewOnly, FieldData[] fields) {
        this.entityTableName = entityTableName;
        this.entityFullName = entityFullName;
        this.entityComment = entityComment;
        this.isBasicBean = isBasicBean;
        this.isTreeStructure = isTreeStructure;
        this.isViewOnly = isViewOnly;
        this.fields = fields;
    }

    public boolean isViewOnly() {
        return isViewOnly;
    }

    public void setViewOnly(boolean viewOnly) {
        isViewOnly = viewOnly;
    }

    public EntityData() {
    }

    public String getEntityFullName() {
        return entityFullName;
    }

    public void setEntityFullName(String entityFullName) {
        this.entityFullName = entityFullName;
    }

    public String getEntityComment() {
        return entityComment;
    }

    public void setEntityComment(String entityComment) {
        this.entityComment = entityComment;
    }

    public boolean isBasicBean() {
        return isBasicBean;
    }

    public void setBasicBean(boolean basicBean) {
        isBasicBean = basicBean;
    }

    public boolean isTreeStructure() {
        return isTreeStructure;
    }

    public void setTreeStructure(boolean treeStructure) {
        isTreeStructure = treeStructure;
    }

    public FieldData[] getFields() {
        return fields;
    }

    public void setFields(FieldData[] fields) {
        this.fields = fields;
    }

    @Override
    public String toString() {
        return Serializer.doSerialize(this);
    }
    public String toEscapedString(){
        return StringEscapeUtils.escapeHtml4(toString());
    }
}
